﻿using FlexFlow.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FlexFlow.Runtime
{
    /// <summary>
    /// 提供通知文件夹的工厂模式创建
    /// </summary>
    public class NotificationCatalogFactory
    {

        /// <summary>
        /// 获取或设置工厂中消息的发送者
        /// </summary>
        public string Sender { get; set; }
        /// <summary>
        /// 获取或设置工厂中消息的默认类型
        /// </summary>
        public NotificationType DefaultType { get; set; }
        /// <summary>
        /// 获取或设置工厂中消息的默认描述
        /// </summary>
        public string DefaultDescription { get; set; }

        /// <summary>
        /// 创建新的目录实例
        /// </summary>
        /// <param name="reciver">
        /// 该目录的接收者ID
        /// </param>
        /// <param name="type">
        /// 该目录的类型
        /// </param>
        /// <param name="description">
        /// 该目录的描述
        /// </param>
        /// <returns>
        /// 创建的新目录
        /// </returns>
        public NotificationCatalog CreateCatalog(Guid reciver, NotificationType? type = null, string description = null)
        {
            return CreateCatalog(reciver, this.Sender, type, description);
        }
        /// <summary>
        /// 创建新的目录实例
        /// </summary>
        /// <param name="reciver">
        /// 该目录的接收者
        /// </param>
        /// <param name="sender">
        /// 该目录的发送者
        /// </param>
        /// <param name="type">
        /// 该目录的类型
        /// </param>
        /// <param name="description">
        /// 该目录的描述
        /// </param>
        /// <returns>
        /// 创建的新目录
        /// </returns>
        public NotificationCatalog CreateCatalog(Guid reciver, string sender, NotificationType? type = null, string description = null)
        {
            return new NotificationCatalog()
            {
                Sender = sender,
                Reciver = reciver,
                Type = (type == null ? DefaultType : (NotificationType)type),
                Description = (description == null ? DefaultDescription : description)
            };
        }
    
    }
}
